﻿using com.lib.events;
using com.lib.manager;
using com.lib.net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace com.lib.main
{
    /// <summary>
    /// 需要继承此基类
    /// </summary>
   public class Lib:MonoBehaviour
    {

       public static Lib instance = null;

       void Awake()
       {
           instance = this;
           Application.runInBackground = true;
           GameConfig.persistentDataPath = Application.persistentDataPath + "/";
           GameConfig.streamingAssetsPath = Application.streamingAssetsPath + "/";
           Screen.sleepTimeout = SleepTimeout.NeverSleep;
           this.gameObject.AddComponent<HttpNetWork>();
           this.gameObject.AddComponent<ResourceManager>();
           this.gameObject.AddComponent<PlatformManager>();
           InitAudio();
           DontDestroyOnLoad(this.gameObject);
       }

       private void InitAudio()
       {
           GameObject g = new GameObject();
           g.name = "AudioManager";
           g.AddComponent<AudioManager>();
       }
 
       /// <summary>
       /// 事件处理
       /// </summary>
       void Update()
       {
           EventLib.Instance.Update();
           TimerManager.Instance.Update();
           DownLoadFileManager.Update();
       }

    }
}
